xxxxxxxxxx
92
var lines;
var markov;
var data1;
var data2;
var voice = new p5.Speech();
var img;
function preload() {
img = createImg('eolien.gif', 'éolienne');
img2 = loadImage('France.png');
img3 = loadImage('logo.png');
data1 = loadStrings('météos1.txt');
data2 = loadStrings('météos2.txt');
song = loadSound('jingle.mp3');
blackoak = loadFont('Blackoak.otf');
tf1 = loadFont ("typoTF1.otf");
}
function setup(){
createCanvas(720,540);
img.position(0,0, 'absolute');
img.style("z-index: -1");
voice.setPitch(0,2);
voice.setRate(1,5);
voice.speak("Prévisions météorologiques - janvier 2047");
song.play();
song.setVolume(0,7);
textSize(24);
textFont("blackoak");
fill(242, 225, 75);
textAlign (LEFT);
stroke(255, 116, 88);
strokeWeight(2.5);
text('PRÉVISIONS MÉTÉOROLOGIQUES', 92, 30, 288);
frameRate(3);
textSize(12);
textFont ("blackoak");
fill(193, 210, 227);
textAlign (LEFT);
noStroke();
text('- bulletin mensuel de Météo-France -', 12, 498, 222);
frameRate(3);
lines = ["> AFFICHER LA MÉTÉO DE CE MOIS <"];
markov = new RiMarkov(4);
markov.loadText(data1.join(''));
markov.loadText(data2.join(''));
drawText();
}
function drawText() {
stroke(193, 210, 227)
fill(112, 119, 133);
rect(460, 325, 225, 160);
stroke(112,119,133);
fill(193, 210, 227);
text(lines.join(' '), 467, 330, 220, 155);
voice.speak(lines.join(' '));
image(img2, 385, 42);
image(img3, 12, 15);
}
function mouseClicked() {
// choisir le nombre de phrases à générer, ici 10, il combine les phrases
//lines = markov.generateSentences(10);
// il est aussi possible de combiner les mots avec la ligne ci-dessous
lines = markov.generateTokens(100);
drawText();
}
function keyReleased() {
if (key == 's' || key == 'S') {
saveCanvas(year()+month()+day()+'-'+hour()+ minute() + second() +'_markov'+ '.jpg');
}
}
function draw() {
//image(img2, 375, 28);
//background(0);
//image(img, 20, 40);
}